/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.sisportaria.bean;

import br.com.sisportaria.view.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author lac
 */
@Entity
@Table(name = "PESSOA")
@NamedQueries({@NamedQuery(name = "Pessoa.findAll", query = "SELECT p FROM Pessoa p"), @NamedQuery(name = "Pessoa.findByPsncodg", query = "SELECT p FROM Pessoa p WHERE p.psncodg = :psncodg"), @NamedQuery(name = "Pessoa.findByPsnmatc", query = "SELECT p FROM Pessoa p WHERE p.psnmatc = :psnmatc"), @NamedQuery(name = "Pessoa.findByPscdesc", query = "SELECT p FROM Pessoa p WHERE p.pscdesc = :pscdesc"), @NamedQuery(name = "Pessoa.findByPsclogn", query = "SELECT p FROM Pessoa p WHERE p.psclogn = :psclogn"), @NamedQuery(name = "Pessoa.findByPscsenh", query = "SELECT p FROM Pessoa p WHERE p.pscsenh = :pscsenh"), @NamedQuery(name = "Pessoa.findByPscmail", query = "SELECT p FROM Pessoa p WHERE p.pscmail = :pscmail"), @NamedQuery(name = "Pessoa.findByPsclota", query = "SELECT p FROM Pessoa p WHERE p.psclota = :psclota"), @NamedQuery(name = "Pessoa.findByPsdcadt", query = "SELECT p FROM Pessoa p WHERE p.psdcadt = :psdcadt"), @NamedQuery(name = "Pessoa.findByPsncnh", query = "SELECT p FROM Pessoa p WHERE p.psncnh = :psncnh"), @NamedQuery(name = "Pessoa.findByPsdvcnh", query = "SELECT p FROM Pessoa p WHERE p.psdvcnh = :psdvcnh"), @NamedQuery(name = "Pessoa.findByPslativ", query = "SELECT p FROM Pessoa p WHERE p.pslativ = :pslativ")})
@NamedQuery(name = "Pessoa.verificaLogin", query = "SELECT p FROM Pessoa p WHERE p.psclogn = :PSCLOGN and p.pscsenh = :PSCSENH")
public class Pessoa implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "PSNCODG")
    private Integer psncodg;
    @Column(name = "PSNMATC")
    private Integer psnmatc;
    @Column(name = "PSCDESC")
    private String pscdesc;
    @Column(name = "PSCLOGN")
    private String psclogn;
    @Column(name = "PSCSENH")
    private String pscsenh;
    @Column(name = "PSCMAIL")
    private String pscmail;
    @Column(name = "PSCLOTA")
    private String psclota;
    @Column(name = "PSDCADT")
    @Temporal(TemporalType.DATE)
    private Date psdcadt;
    @Column(name = "PSNCNH")
    private String psncnh;
    @Column(name = "PSDVCNH")
    @Temporal(TemporalType.DATE)
    private Date psdvcnh;
    @Column(name = "PSLATIV")
    private Boolean pslativ;
    @OneToMany(mappedBy = "psncodg")
    private List<PessoaTipo> pessoaTipoList;

    public Pessoa() {
    }

    public Pessoa(Integer psncodg) {
        this.psncodg = psncodg;
    }

    public Integer getPsncodg() {
        return psncodg;
    }

    public void setPsncodg(Integer psncodg) {
        Integer oldPsncodg = this.psncodg;
        this.psncodg = psncodg;
        changeSupport.firePropertyChange("psncodg", oldPsncodg, psncodg);
    }

    public Integer getPsnmatc() {
        return psnmatc;
    }

    public void setPsnmatc(Integer psnmatc) {
        Integer oldPsnmatc = this.psnmatc;
        this.psnmatc = psnmatc;
        changeSupport.firePropertyChange("psnmatc", oldPsnmatc, psnmatc);
    }

    public String getPscdesc() {
        return pscdesc;
    }

    public void setPscdesc(String pscdesc) {
        String oldPscdesc = this.pscdesc;
        this.pscdesc = pscdesc;
        changeSupport.firePropertyChange("pscdesc", oldPscdesc, pscdesc);
    }

    public String getPsclogn() {
        return psclogn;
    }

    public void setPsclogn(String psclogn) {
        String oldPsclogn = this.psclogn;
        this.psclogn = psclogn;
        changeSupport.firePropertyChange("psclogn", oldPsclogn, psclogn);
    }

    public String getPscsenh() {
        return pscsenh;
    }

    public void setPscsenh(String pscsenh) {
        String oldPscsenh = this.pscsenh;
        this.pscsenh = pscsenh;
        changeSupport.firePropertyChange("pscsenh", oldPscsenh, pscsenh);
    }

    public String getPscmail() {
        return pscmail;
    }

    public void setPscmail(String pscmail) {
        String oldPscmail = this.pscmail;
        this.pscmail = pscmail;
        changeSupport.firePropertyChange("pscmail", oldPscmail, pscmail);
    }

    public String getPsclota() {
        return psclota;
    }

    public void setPsclota(String psclota) {
        String oldPsclota = this.psclota;
        this.psclota = psclota;
        changeSupport.firePropertyChange("psclota", oldPsclota, psclota);
    }

    public Date getPsdcadt() {
        return psdcadt;
    }

    public void setPsdcadt(Date psdcadt) {
        Date oldPsdcadt = this.psdcadt;
        this.psdcadt = psdcadt;
        changeSupport.firePropertyChange("psdcadt", oldPsdcadt, psdcadt);
    }

    public String getPsncnh() {
        return psncnh;
    }

    public void setPsncnh(String psncnh) {
        String oldPsncnh = this.psncnh;
        this.psncnh = psncnh;
        changeSupport.firePropertyChange("psncnh", oldPsncnh, psncnh);
    }

    public Date getPsdvcnh() {
        return psdvcnh;
    }

    public void setPsdvcnh(Date psdvcnh) {
        Date oldPsdvcnh = this.psdvcnh;
        this.psdvcnh = psdvcnh;
        changeSupport.firePropertyChange("psdvcnh", oldPsdvcnh, psdvcnh);
    }

    public Boolean getPslativ() {
        return pslativ;
    }

    public void setPslativ(Boolean pslativ) {
        Boolean oldPslativ = this.pslativ;
        this.pslativ = pslativ;
        changeSupport.firePropertyChange("pslativ", oldPslativ, pslativ);
    }

    public List<PessoaTipo> getPessoaTipoList() {
        return pessoaTipoList;
    }

    public void setPessoaTipoList(List<PessoaTipo> pessoaTipoList) {
        this.pessoaTipoList = pessoaTipoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (psncodg != null ? psncodg.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pessoa)) {
            return false;
        }
        Pessoa other = (Pessoa) object;
        if ((this.psncodg == null && other.psncodg != null) || (this.psncodg != null && !this.psncodg.equals(other.psncodg))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sisportaria.view.Pessoa[psncodg=" + psncodg + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
